<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>百科</title>
</head>
<body>
<fieldset class="layui-elem-field" style="margin: 20px; padding: 20px;">
    <legend>词条检索</legend>
    <div class="layui-field-box">
        <form class="layui-form layui-form-pane" lay-filter='formA'>
            <div class="layui-form-item">
                <label class="layui-form-label">收件人：</label>
                <div class="layui-input-block">
                    <input type="text" name="to" placeholder="请输入收件人地址"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">主题：</label>
                <div class="layui-input-block">
                    <input type="text" name="sub" placeholder="请输入主题"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">内容：</label>
                <div class="layui-input-block">
                    <input type="text" name="text" placeholder="请输入内容"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="button" class="layui-btn" value="发送" lay-submit lay-filter="send" /> 
                    <input type="reset" class="layui-btn layui-btn-primary" value="重置" />
                </div>
<!--                 <input type="button" class="layui-btn" value="定时发送" onclick="sendMail()" />  -->
            </div>
        </form>
    </div>
</fieldset>
    <script type="text/javascript">
    formSubmit('/mail/send', 'submit(send)', true, function(data) {
        layer.msg(data.text);
    });
    function sendMail(){
    	layer.open({
    		  title: '设定发送时间'
    		  ,content: '<input type="text" id="time" class="layui-input">'
        	  ,success: function(layero, index){//console.log(layero, index);
        		  	laydate.render({elem: '#time',type:'datetime'});
        	  }
  	  		  ,yes: function(index, layero){
  	  			var d = form.val("formA");
  	  			d.time=$('#time').val();
  	  			ajax('/mail/sendTime', d, true, function(data){
  	  	  			layer.close(index);//如果设定了yes回调，需进行手工关闭
  	  	  		})
  	  		  }
    	});     
    }
    </script>
</body>
</html>